home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / gs3.53 / markhint.ps < prev    next >
Text File  |  1996-01-10  |  3KB  |  113 lines

  1. %    Copyright (C) 1994 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % markhint.ps
  16. % Draw the hints for a Type 1 font.
  17.  
  18. (type1ops.ps) run
  19.  
  20. /mhsetup        % <matrix> <print> mhsetup -
  21.  { /mhprint exch def
  22.    /mhmx exch def
  23.    /mhdash 0 9 gsave initmatrix dtransform grestore idtransform add abs def
  24.    gsave
  25.    clippath pathbbox
  26.    2 index sub /bbh exch def
  27.    2 index sub /bbw exch def
  28.    /bby exch def
  29.    /bbx exch def
  30.    grestore
  31.  } def
  32.  
  33. /markfonthints        % <matrix> <print> markfonthints -
  34.  { mhsetup
  35.  } def
  36.  
  37. /hmark            % <y> hmark -
  38.  { bbx exch moveto bbw 0 rlineto stroke
  39.  } def
  40. /vmark            % <x> vmark -
  41.  { bby moveto 0 bbh rlineto stroke
  42.  } def
  43. /pmark            % <x> <y> pmark -
  44.  { newpath 0 4.5 gsave initmatrix dtransform grestore idtransform add abs
  45.    0 360 arc stroke
  46.  } def
  47. /mchdict mark
  48.   /hsbw { pop 0 mhmx transform translate 0 0 pmark }
  49.   /sbw { pop pop mhmx transform translate 0 0 pmark }
  50.   /hstem
  51.    { mhprint { (hstem ) print 2 copy 2 packedarray == } if
  52.      1 index add exch gsave
  53.      [mhdash] 0 setdash 0 exch mhmx transform exch pop hmark
  54.      [mhdash 2 div dup 2 mul] 0 setdash 0 exch mhmx transform exch pop hmark
  55.      grestore
  56.    }
  57.   /vstem
  58.    { mhprint { (vstem ) print 2 copy 2 packedarray == } if
  59.      1 index add exch gsave
  60.      [mhdash] 0 setdash 0 mhmx transform pop vmark
  61.      [mhdash 2 div dup 2 mul] 0 setdash 0 mhmx transform pop vmark
  62.      grestore
  63.    }
  64.   /callothersubr
  65.    { 3 eq
  66.       { pop
  67.         % We're replacing hints; lighten the color.
  68.     currentrgbcolor 3 { 2 mul 3 div 3 1 roll } repeat setrgbcolor
  69.       }
  70.       { { pop } repeat
  71.       } ifelse
  72.    }
  73.   /callsubr
  74.    { Private /Subrs get exch get mchinterp
  75.    }
  76.   /pop
  77.    {
  78.    }
  79.   /return
  80.    {
  81.    }
  82. .dicttomark def
  83.  
  84. /mchinterp        % <charstring> mchinterp -
  85.  { 4330 exch dup length string .type1decrypt exch pop
  86.    dup length lenIV sub lenIV exch getinterval
  87.    0 () /SubFileDecode filter
  88.    mark exch charstack_read ]
  89.     { dup type /nametype eq
  90.        { mchdict exch .knownget { exec } { cleartomark mark } ifelse
  91.        }
  92.       if
  93.     }
  94.    forall
  95.  } def
  96.  
  97. /markcharhints        % <charname> <matrix> <print> markcharhints -
  98.  { mhsetup
  99.    gsave mark
  100.    /Private currentfont /Private get def
  101.    Private rcheck    % make sure we won't get an access error
  102.     { /lenIV Private /lenIV .knownget not { 4 } if def
  103.       currentfont /CharStrings get 3 -1 roll get mchinterp
  104.     }
  105.     { (Sorry, this font is protected; I can't show the hints.\n) print flush
  106.     }
  107.    ifelse
  108.    cleartomark grestore
  109.  } def
  110.